package net.zhangbaolin.systemadmin.exception;

import net.zhangbaolin.systemadmin.common.ResponseJson;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice //全局异常捕获
public class MyExceptionHandler {

    @ExceptionHandler(value =Exception.class)
    @ResponseBody
    public ResponseJson exceptionHandler(Exception e){
        return ResponseJson.failed(e.getMessage());
    }
}